#lang racket


(provide
 (struct-out node)
 
 ; primitives
 (struct-out arc-node)
 (struct-out elliptical-arc-node)
 (struct-out circle-node)
 (struct-out donut-node)
 (struct-out ellipse-node)
 (struct-out helix-2d-node)
 (struct-out line-node)
 (struct-out ngon-node)
 (struct-out nurbs-curve-node)
 (struct-out nurbs-surface-node)
 (struct-out rectangle-node)
 (struct-out spline-node)
 (struct-out star-node)
 ;(struct-out text-node)
 
 (struct-out box-node)
 (struct-out cone-node)
 (struct-out cone-frustrum-node)
 (struct-out cylinder-node)
 (struct-out pipe-node)
 (struct-out sphere-node)
 
 ; operations
 (struct-out extrude-node)
 (struct-out intersect-node)
 (struct-out join-node)
 (struct-out loft-node)
 (struct-out move-node)
 (struct-out offset-node)
 (struct-out rotate-node)
 (struct-out scale-node)
 (struct-out subtract-node)
 (struct-out sweep-node)
 (struct-out union-node)
 
 ; lang
 (struct-out on-left-node)
 (struct-out on-right-node)
 (struct-out on-x-node)
 
 (struct-out on-front-node)
 (struct-out on-back-node)
 (struct-out on-y-node)
 
 (struct-out on-top-node)
 (struct-out on-bottom-node)
 (struct-out on-z-node)
 
 (struct-out parametrize-node)
 
 ; autocad
 (struct-out arc-ppp-node))


; node

(define-struct node
  ((parent #:auto))
  #:mutable)


; primitives

(define-struct (arc-node node)
  (angle radius))

(define-struct (elliptical-arc-node node)
  (angle x-radius y-radius))

(define-struct (circle-node node)
  (radius))

(define-struct (donut-node node)
  (inner-radius outer-radius))

(define-struct (ellipse-node node)
  (x-radius y-radius))

(define-struct (helix-2d-node node)
  (base-radius top-radius turns turn-height direction))

(define-struct (line-node node)
  (points))

(define-struct (ngon-node node)
  (width sides))

(define-struct (nurbs-curve-node node)
  (controls knots))

(define-struct (nurbs-surface-node node)
  (controls u-knots v-knots))

(define-struct (rectangle-node node)
  (width length))

(define-struct (spline-node node)
  (points))

(define-struct (star-node node)
  (width sides stride))

;(define-struct (text-node node)
;  (text))

(define-struct (box-node node)
  (width length height))

(define-struct (cone-node node)
  (radius height))

(define-struct (cone-frustrum-node node)
  (base-radius top-radius height))

(define-struct (cylinder-node node)
  (radius height))

(define-struct (pipe-node node)
  (inner-radius outer-radius height))

(define-struct (sphere-node node)
  (radius))


; operations

; edit: consider renaming surface -> shape
(define-struct (extrude-node node)
  (length surface))

(define-struct (intersect-node node)
  (shape1 shape2))

(define-struct (join-node node)
  (shapes))

(define-struct (loft-node node)
  (closed shapes))

(define-struct (move-node node)
  (position shape))

(define-struct (offset-node node)
  (distance shape))

(define-struct (rotate-node node)
  (angle normal shape))

(define-struct (scale-node node)
  (scale shape))

(define-struct (subtract-node node)
  (shape1 shape2))

(define-struct (sweep-node node)
  (shape path))

(define-struct (union-node node)
  (shape1 shape2))


; lang

(define-struct (on-left-node node)
  (shape1 shape2))

(define-struct (on-right-node node)
  (shape1 shape2))

(define-struct (on-x-node node)
  (direction shape1 shape2))

(define-struct (on-front-node node)
  (shape1 shape2))

(define-struct (on-back-node node)
  (shape1 shape2))

(define-struct (on-y-node node)
  (direction shape1 shape2))

(define-struct (on-top-node node)
  (shape1 shape2))

(define-struct (on-bottom-node node)
  (shape1 shape2))

(define-struct (on-z-node node)
  (direction shape1 shape2))


(define-struct (parametrize-node node)
  (shape))


; autocad

(define-struct (arc-ppp-node node)
  (p1 p2 p3))